<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2019-2020 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace app\validate\bill;

use think\Validate;

class BillCourseValidate extends Validate
{
    protected $rule = [
        'id' => 'require|number',
        'cate_id|费用类目' => 'require|number',
        'property_id|房间' => 'require|number',
        'finance_no|流水编号' => 'require',
        'finance_type|收支类型' => 'require|number',
        'start_date|开始日期' => 'require',
        'end_date|结束时间' => 'require',
        'amount|收支金额' => 'require',
    ];

    public function sceneAdd()
    {
        return $this->remove('id', 'require');
    }

    public function sceneCheckAdd()
    {
        return $this->only(['check_type', 'check_amount'])
            ->append('check_type', 'require|number');
    }

    public function sceneAffirmAdd()
    {
        return $this->only(['affirm_type', 'affirm_amount'])
            ->append('affirm_type', 'require|number');
    }

    public function sceneEdit()
    {
        return $this->remove('id', 'require')
            ->remove('finance_type', 'require')
            ->remove('finance_no', 'require')
            ->remove('property_id', 'require')
            ->remove('cate_id', 'require');
    }

    public function sceneDel()
    {
        return $this->only(['ids'])->append('ids', 'require|array');
    }

}